<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 100px;
            height: 100px;
            background-color: red;
            /* 2.设置动画名称*/
            animation-name: move;
            /* 3.动画持续时间*/
            animation-duration: 2s;
            /*4.动画速度曲线*/
            animation-timing-function: linear;
            /* 5.设置动画执行次数 n(n次) infinite（无限次）*/
            animation-iteration-count: infinite;
            /*设置都还是否反向执行 */
            animation-direction: alternate;      
            /*设置动画等待时间*/  
            animation-delay: 2s;
        }
        section{
            width: 100px;
            height: 100px;
            /*上外边距*/
            margin-top: 20px;
            background-color: red;
            /*设置动画*/
            animation: rotate 2s linear infinite alternate;
        }
        img{
            animation:  pound .2s linear infinite alternate;
        }
        /*定义动画关键帧*/
        @keyframes move {
            /* from 动画开始
            to 动画结束     
            百分比 0% 25% 50% 100%*/
            from{
                margin-left: 0px;
            }
            to{
                margin-left: 200px;
            }
                }
                @keyframes rotate {
                    0%{
                        background-color: red;
                        /*形变 平移 旋转 缩放*/
                        transform: translateX(0px) rotate(0deg);
                        /*设置圆角边框*/
                        border-radius: 0px;
                    }
                    100%{
                        background-color: pink;
                        transform: translateX(200px) rotate(360rdg);
                        border-radius: 50%;
                    }
                }
                @keyframes pound {
                    from{
                        /*scale 缩小和放大 >1放大 <1 缩小*/
                        transform: scale(0.8);
                    }                    
                    to{
                        transform: scale(1.2);
                    }
                }
    </style>
</head>
<body>
    <div></div>
    <section></section>
    <img width="150px" src="https://img0.baidu.com/it/u=3587366479,4195056249&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1721322000&t=686e3abcef0a54b1692179e64e732275"
</body>
</html>
